;(function(){
  'use strict';
  angular.module('controllers.oldOMDisplay.upayQM')
  .controller('fullAbnormalCtrl', fullAbnormalCtrl);

  function fullAbnormalCtrl($scope,COREDATA,UpayFullAbnorSelecotor,UpayFullAbnorQueryParam,UpayFullAbnorViewObj){
    $scope.selector = UpayFullAbnorSelecotor.setSelector();
    $scope.fullAbnormal = UpayFullAbnorQueryParam.initParam();
    $scope.date = UpayFullAbnorQueryParam.initDate();
    $scope.flag = UpayFullAbnorQueryParam.initFlag();
    $scope.viewObj = UpayFullAbnorViewObj.initViewObj();
    $scope.fullAbnormalQuery = UpayFullAbnorQueryParam.fullAbnorQueryFn;
    $scope.exportUrl = COREDATA.FORMPREFIX+'OMdisplay/upayQM/businessQM/allAbnormal/export';
    $scope.resetParam = function(){
      $scope.fullAbnormal = UpayFullAbnorQueryParam.initParam();
      $scope.date = UpayFullAbnorQueryParam.initDate();
      $scope.flag = UpayFullAbnorQueryParam.initFlag();
      $scope.viewObj = UpayFullAbnorViewObj.initViewObj();
    };

    $scope.$watch('fullAbnormal.timeType',function(n,o){
      if(n === o) return;
      $scope.date = UpayFullAbnorQueryParam.initDate();
    },true);

    $scope.$watch('fullAbnormal.agencyType',function(n,o){
      if(n === o) return;
      $scope.selector = UpayFullAbnorSelecotor.setSelector(n.code);
    }); 
  }

  fullAbnormalCtrl.$inject = ['$scope','COREDATA','UpayFullAbnorSelecotor','UpayFullAbnorQueryParam','UpayFullAbnorViewObj'];

})();